<!DOCTYPE html>
<html lang="zh-CN" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="layout/default" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>BUG上报</title>
    <meta charset="UTF-8">
    <link th:href="@{/assets/css/bugDetial.css}" rel="stylesheet" type="text/css"/>
    <!--[if lt IE 10]>
    <link th:href="@{/assets/css/ie.css}" rel="stylesheet" type="text/css"/>
    <![endif]-->
    <script>
        $(document).ready(
                function () {
                    var validateMessageBox = $('#validateMessageBox');
                    var bugEditForm = $('#bugEditForm');
                    bugEditForm.validate({
                        errorElement: 'label',
                        errorClass: 'help-block',
                        focusInvalid: true,
                        ignore: "",
                        rules: {},
                        messages: {},
                        errorContainer: validateMessageBox,
                        errorPlacement: function (error, element) {

                            this.errorContainer.addClass('note-danger').html(
                                    "<p>输入有误，请先更正。</p>").show();
                            var formGroup = $(element).closest('.form-group');
                            var errorElement = formGroup.children('span.'
                                    + this.errorClass);
                            if (!errorElement || errorElement.length == 0) {
                                errorElement = $('<span/>').addClass(
                                        this.errorClass);
                                errorElement.appendTo(formGroup);
                            }
                            error.appendTo(errorElement);

                        },
                        highlight: function (element) {
                            $(element).closest('.form-group').removeClass(
                                    'has-success').addClass('has-error');
                        },

                        unhighlight: function (element) {
                            $(element).closest('.form-group').removeClass(
                                    'has-error').addClass('has-success');
                        },

                        success: function (label, element) {
                            label.closest('.form-group').removeClass('has-error');
                        },

                        submitHandler: function (form) {
                            App.blockUI(window, true);
                            form.submit();
                        }
                    });
                });

        function goBack() {
            location.href = "[[@{/bug/list}]]";
        }
    </script>
</head>
<body>
<div layout:fragment="content" th:remove="tag">
    <div th:replace="fragments/tool :: tipMessage (type='',content=${message})" th:remove="tag"></div>
    <div th:replace="fragments/toolEmail :: emailMessage (type='',content=${risMessage})" th:remove="tag"></div>
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <ul class="page-breadcrumb breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a th:href="@{/}">首页</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a th:href="@{/bug/list}">BUG处理</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li><a href="#">BUG详情</a></li>
            </ul>
            <!-- END PAGE TITLE & BREADCRUMB-->
        </div>
    </div>
    <div class="panel panel-default content-center pane-width">
        <div class="panel-heading">
            <p class="panel-title bug-title">[权限管理系统]Bug上报</p>
        </div>
        <div class="panel-body content-center pane-div">
            <div class="row col-md-12">
                <div class="col-md-7">
                    <div class="form-group">
                        <label>BUG编号：</label>
                        <label th:text="${bugInfo.id}">BUG编号</label>
                    </div>
                    <div class="form-group">
                        <label>BUG状态：</label>
                        <th:block th:if="${bugInfo.bugState} == '已处理'">
                            <label th:text="${bugInfo.bugState}" class="handler-status">BUG状态</label>
                        </th:block>
                        <th:block th:if="${bugInfo.bugState} == '未处理'">
                            <label th:text="${bugInfo.bugState}" class="un-handler-status">BUG状态</label>
                        </th:block>
                    </div>
                    <div class="form-group">
                        <label>操作账号：</label>
                        <label th:text="${bugInfo.username}">操作账号</label>
                    </div>
                    <div class="form-group">
                        <label>所属机构：</label>
                        <label th:text="${bugInfo.bugPart}">所属机构</label>
                    </div>
                    <div class="form-group">
                        <label>发生时间：</label>
                        <label th:text="${bugInfo.bugTime}">发生时间</label>
                    </div>
                    <div class="form-group">
                        <label>异常类型：</label>
                        <label th:text="${bugInfo.bugType}">异常类型</label>
                    </div>
                    <div class="form-group">
                        <label>异常信息：</label>
                        <label th:text="${bugInfo.bugInfo}" class="un-handler-status">异常信息</label>
                    </div>
                </div>
                <form class="form-horizontal" role="form" th:object="${bugInfo}" th:action="@{/bug/update}"
                      id="bugEditForm" method="post">
                    <input type="hidden" th:field="*{id}">
                    <input type="hidden" th:field="*{bugState}">
                    <input type="hidden" th:field="*{username}">
                    <input type="hidden" th:field="*{bugPart}">
                    <input type="hidden" th:field="*{bugTime}">
                    <input type="hidden" th:field="*{bugInfo}">
                    <input type="hidden" th:field="*{bugType}">
                    <input type="hidden" th:field="*{systemName}">
                    <input type="hidden" th:field="*{SystemVersion}">

                    <div class="col-md-5">
                   <textarea rows="18" th:field="*{bugRevise}"
                             class="form-control textarea-size" onblur="if(this.value == ''){this.style.color = '#ACA899';
                              this.value = '请在此处填写异常处理方案及对应策略，字数不多于200字。'; }"
                             onfocus="if(this.value == '请在此处填写异常处理方案及对应策略，字数不多于200字。'){this.value =''; this.style.color = '#000000'; }"
                             style="color:#ACA899;">在此处填写备注</textarea>
                    </div>

                    <div class="row">
                        <div>
                            <label>BUG处理人：</label>
                            <th:block th:if="*{bugState} == '已处理'">
                                <label th:text="*{bugReviseUser}">BUG处理人</label>
                            </th:block>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-offset-10 col-md-6">
                            <button type="submit" class="btn blue">
                                提交处理
                            </button>
                            <button type="button" class="btn default" onclick="goBack()">返 回</button>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
</div>

</body>
</html>